package pref.junx.flybird.activity.addGroup;

import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import pref.junx.flybird.R;
import pref.junx.flybird.activity.main.NewMainActivity;
import pref.junx.flybird.base.BaseActicvitylhy;
import pref.junx.flybird.entity.FriendShip;
import pref.junx.flybird.tools.JumpUtil;


/**
 * Created by 半生瓜 on 2017/8/7.
 */

public class AddGroup_Actvity extends BaseActicvitylhy<AddGroup_Presenter, AddGroup_Model> implements AddGroup_Conteact.View {
    EditText editText;
    Button button;

    @Override
    public int getLayoutId() {
return R.layout.add_group_layout;    }

    @Override
    public void initview() {
   editText=(EditText)findViewById(R.id.add_friend_EditText);
        button=(Button) findViewById(R.id.add_friend_button);
        button.setOnClickListener(this);

    }

    @Override
    public void processClick(View view) {
        if(editText.getText().length()==0){
            t.show_l("请输入信息");
        }else {
            FriendShip friendShip=new FriendShip();
            friendShip.setProposer_id(editText.getText().toString().trim());
            friendShip.setClaimant_id(String.valueOf(spTools.getInt("user_id")));
            presenter.addfri(friendShip);
        }


    }


    @Override
    public void init() {


    }





    @Override
    public void success() {

    }

    @Override
    public void result(String a) {

    }

    @Override
    public void susses() {
        t.show_l("添加成功");
        spTools.setInt("code",1);
        NewMainActivity.newMainActivity.finish();
        JumpUtil.to(c,NewMainActivity.class);
        finish();
    }

    @Override
    public void fail() {
        t.show_l("添加失败");
        NewMainActivity.newMainActivity.finish();
        JumpUtil.to(c,NewMainActivity.class);
        finish();
    }
}


